package thread;

import java.util.Timer;
import java.util.TimerTask;

public class Demo31 {
    public static void main(String[] args) {
        //Timer timer = new Timer();
        MyTimer timer = new MyTimer();

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello Timer1");
            }
        },1000);

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello Timer2");
            }
        },2000);


        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello Timer3");
            }
        },3000);
        System.out.println("程序开始启动!");
    }
}
